Atari Basic abschalten (ohne Option-Taste)...

← Zurück zum Forum

patjomki schrieb:

DocSash schrieb: Nochmal kurz wegen des Basics: nachdem ich Depp ja nicht drauf geachtet hatte, dass das im Emulator noch immer aktiviert war, und dadurch ja von einem Top von $A000 ausgegangen bin, stellte sich mir auch die Frage, ob man das nicht auch programmatisch lösen könnte, was ja anscheinend tatsächlich geht. Wenn ihr dazu vielleicht noch eben einen Tipp hättet, wie man das macht?

Also ich mache das immer so:

``` org $2000

; Diese Routine wird als erstes geladen und schaltet das BASIC ($a000-$bfff) aus, ; d.h. der Anwender muss nicht mehr zwingend OPTION gedrückt halten initialize lda $d301 ; PortB ora #$2 ; BASIC ausschalten sta $d301 rts

    ini initialize

```

Dazu auch ein Topic im AA-Forum: https://forums.atariage.com/topic/238018-can-a-program-disable-basic-by-its-own/ mit einigen Sources in Assembler und Mad Pascal. Bill Wilkinson (Autor von Inside Atari Basic, etc.) hat im Compute! Magazin mal eine kurze Routine released (XEX hat ca. 57 Bytes) die das Basic automatisch abschaltet. Hier der Assembler Sourcecode dazu:

         org $0400
;
L0400:      lda PORTB
            ora #$02
            sta PORTB
            lda #$01
            sta BASICF
            lda #$0C
            jsr OpenE
            lda #$C0
            sta RAMTOP
            lda #$03
OpenE:      sta IOCB0+ICCOM
            lda #<Name
            sta IOCB0+ICBAL
            lda #>Name
            sta IOCB0+ICBAH
            ldx #$00
            jmp CIOV
Name:      .byte "E:"
            .byte $00
;
            org $02E2
;
            .word L0400
;

Siehe auch JAC's Seite mit vielen hilfreichen Tips: http://www.wudsn.com/index.php/productions-atari800/tutorials/tips

=> The program should switch off BASIC automatically if it requires BASIC to be disabled.

Reason: Don't force the user to remember when to press OPTION and when not.

Remember that the default in many modified operating systems and emulators is that BASIC is off. On a real computer, the default is the BASIC is on. So if the area $A000-$BFFF is used already during loading, no data will be stored in the RAM, and the program will typically crash upon start. The user can be relieved from controlling BASIC by adding the following short INI segment at the beginning of the program file. It saves some bytes using the OPEN and CLOSE vectors from the official E: handler table instead of the CIOV.

        org $2000   ; Can be overwritten by the main program

       .proc loader ; Disable BASIC
        lda #$c0    ; Check if RAMTOP is already OK
        cmp $6a     ; Prevent flickering if BASIC is already off
        beq ramok
        sta $6a     ; Set RAMTOP to end of BASIC
        sta $2e4    ; Set RAMSIZ also

        lda $d301   ; Disable BASIC bit in PORTB for MMU
        ora #$02
        sta $d301

        lda $a000   ; Check if BASIC ROM area is now writeable
        inc $a000
        cmp $a000
        beq ramnok  ; If not, perform error handling....

        lda #$01    ; Set BASICF for OS, so BASIC remains OFF after RESET
        sta $3f8

        ldx #2      ; Close "E:" before re-openining it again
        jsr editor
        ldx #0      ; Open "E:" to ensure screen is not at $9C00
editor  lda $e401,x ; This prevents garbage when loading up to $bc000
        pha
        lda $e400,x
        pha
ramok   rts

ramnok  inc 712     ; Add your error handling here, there still is a ROM....
        jmp ramnok
        .endp

        ini loader  ; Make sure the loader is executed before the main program is loaded

        org $2000   ; Start of main program